<?

function SelectTmpAPSettlement() {
	global $DBConnection;
	$SQL = "DROP TABLE IF EXISTS ais_dnlist";
	$DBConnection->dbc->query($SQL);
	$SQL = "CREATE TEMPORARY TABLE `ais_dnlist` (`nobkt` VARCHAR (20))";
	$DBConnection->dbc->query($SQL);
	
	$SQL = "INSERT INTO ais_dnlist (nobkt) select noref as nobkt ".
		   "SELECT nobkt FROM ais_piutang WHERE noref like 'ND%' AND (nobkt like 'BB%' or nobkt like 'BK%' or nobkt like 'NK%') ";
	$DBConnection->dbc->query($SQL);
}
?>